package miniMax;

import java.util.Iterator;
import java.util.Vector;

import domain.Game;
import domain.Game.action;

public class AlgorithmResultMaxiMax {
	private double	_valueGood;
	private double	_valueBad;
	private action	_act;
	
	public AlgorithmResultMaxiMax(double valueGood, double valueBad, action act) {
		this._valueGood = valueGood;
		this._valueBad	= valueBad;
		this._act		= act;
	}
	public action get_act() {
		return _act;
	}
	public double get_goodValue() {
		return _valueGood;
	}
	public double get_badValue() {
		return _valueBad;
	}
	@Override
	public String toString() {
		return "value good: " + _valueGood + "  value bad: " + _valueBad + " action: " + _act;
	}
	public action setActionThatGotMeHere(StateNode child, Vector<StateNode> children) {
		int i = 0;
		for (Iterator<StateNode> iterator = children.iterator(); iterator.hasNext();) {
			StateNode stateNode = iterator.next();
			if ( child == stateNode ){
				this._act = Game.action.values()[i];
			}
			i++;
		}
		return null;
	}
}
